/**
 * Created with IntelliJ IEDA.
 * Description:
 * User:86186
 * Date:2022-09-23
 * Time:22:29
 */

/**
 * 力扣231:2的幂
 */

public class isPowerOfTwo {
    public boolean isPowerOfTwo(int n) {
        //& 按位与 运算:只有两个数的二进制同时为1，结果才为1，否则为0
        return n > 0 && (n & (n - 1)) == 0;
    }
}
